import {
	http,
	Method
} from "@/utils/request.js";

/**
 * 获取商家商品统计信息 排行前一百的数据
 * @param {*} params
 * @returns
 */
export const goodsStatistics = (params) => {
	return http.request({
		url: `/statistics/goods`,
		method: Method.GET,
		params,
	});
};

/**
 * 获取商品分页列表
 * @param {*} params
 * @returns
 */
export const goodsGoodsList = (params) => {
	return http.request({
		url: `/goods/goods/list`,
		method: Method.GET,
		params,
	});
};
/**
 * 获取商品分页列表
 * @param {*} params
 * @returns
 */
export const goodsGoodsSkuList = (params) => {
	return http.request({
		url: `/goods/goods/sku/list`,
		method: Method.GET,
		params,
	});
};


/**
 * 获取全部经营类目
 * @param {*} params
 * @returns
 */
export const getGoodsCategoryAll = () => {
	return http.request({
		url: `/goods/category/all`,
		method: Method.GET,
	});
};

/**
 * 根据分类id
 * @param {*} category_id
 * @returns
 */
export const getCategoryBrandListDataSeller = (category_id) => {
	return http.request({
		url: `/goods/category/${category_id}/brands`,
		method: Method.GET,
	});
};



/**
 * 获取商品单位列表
 * @param {*} params
 * @returns
 */
export const getGoodsUnitList = (params) => {
	return http.request({
		url: `/goods/goodsUnit`,
		method: Method.GET,
		params
	});
};


/**
 * 获取物流模版
 * @param {*} params
 * @returns
 */
export const getShipTemplate = (params) => {
	return http.request({
		url: `/setting/freightTemplate`,
		method: Method.GET,
		params
	});
};


// 获取当前店铺分类
export const getShopGoodsLabelListSeller = () => {
	return http.request({
		url: `/goods/label`,
		method: Method.GET,
	});
};



// 查询分类绑定参数信息
export const getCategoryParamsListDataSeller = (id) => {
	return http.request({
		url: `/goods/categoryParameters/${id}`,
		method: Method.GET,
	});
};


// 获取草稿商品分页列表
export const getDraftGoodsListData = (params) => {
	return http.request({
		url: `/goods/draftGoods/page`,
		method: Method.GET,
		params
	});
};

// 获取商品详情
export const getGoods = (id) => {
	return http.request({
		url: `/goods/goods/get/${id}`,
		method: Method.GET,
	});
};

// 获取草稿商品详情
export const getDraftGoodsDetail = (id) => {
	return http.request({
		url: `/goods/draftGoods/${id}`,
		method: Method.GET,
	});
};


// 保存发布商品
export function createGoods(params) {
	return http.request({
		url: `/goods/goods/create`,
		method: Method.POST,
		data:params
	});
}

// 编辑商品
export function editGoods(goodsId,params) {
	return http.request({
		url: `/goods/goods/update/${goodsId}`,
		method: Method.PUT,
		data:params
	});
}




